<template>
  <a @click="dialog = true">
    <span>修改汇率</span>
    <a-modal v-model="dialog" title="修改汇率" @ok="submit">
      <a-form-model :form="form">
        <p>USD/NZD</p>
        <a-form-model-item prop="exrate"> 参考汇率：<a-input class="width" v-model="form.exrate" /> </a-form-model-item>
      </a-form-model>
    </a-modal>
  </a>
</template>
<script>
import { updateProjectById } from '@/api/common'
export default {
  name: 'change',
  props: ['record'],
  data() {
    return {
      updateProjectById,
      dialog: false,
      form: {
        exrate: ''
      }
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    async submit() {
      this.dialog = false
      await updateProjectById(this.record.id, this.form)
      this.$emit('update')
    },
    async getData() {
      this.form.exrate = this.record.exrate
    }
  }
}
</script>
<style lang="css" scoped>
.width {
  width: 120px;
}
</style>
